/* Copyright  2009
   @Author
   Richard Changde Yin            e-mail yinchangde@hotmail.com

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/**
 *@filename: options.h
 */

#ifndef __LIBCLIENT_OPTIONS_H__
#define __LIBCLIENT_OPTIONS_H__

#if !defined(__cplusplus)
# include <stdbool.h>
#endif

#ifdef  __cplusplus
extern "C" {
#endif

enum esql_option
{
  CLIENT_OPT_CONNECT_TIMEOUT,
  OPT_COMPRESS,
  OPT_NAMED_PIPE,
  INIT_COMMAND,
  READ_DEFAULT_FILE,
  READ_DEFAULT_GROUP,
  OPT_PROTOCOL,
  SHARED_MEMORY_BASE_NAME,
  OPT_READ_TIMEOUT,
  OPT_WRITE_TIMEOUT,
  OPT_USE_RESULT,
  OPT_USE_REMOTE_CONNECTION,
  OPT_GUESS_CONNECTION,
  SET_CLIENT_IP,
  SECURE_AUTH,
  REPORT_DATA_TRUNCATION,
  OPT_RECONNECT,
  OPT_SSL_VERIFY_SERVER_CERT
};

struct st_client_options {
  unsigned int connect_timeout, read_timeout, write_timeout;
  unsigned int port;
  unsigned long client_flag;
  char *host,*user,*password,*db;
  char *cnf_file,*cnf_group;
  char *ssl_key;        /* PEM key file */
  char *ssl_cert;        /* PEM cert file */
  char *ssl_ca;          /* PEM CA file */
  char *ssl_capath;        /* PEM directory of CA-s? */
  char *ssl_cipher;        /* cipher to use */
  char *shared_memory_base_name;
  unsigned long max_allowed_packet;
  bool use_ssl;        /* if to use SSL or not */
  bool compress,named_pipe;
  bool unused1;
  bool unused2;
  bool unused3;
  bool unused4;
  enum esql_option methods_to_use;
  char *client_ip;
  /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
  bool secure_auth;
  /* 0 - never report, 1 - always report (default) */
  bool report_data_truncation;

  /* function pointers for local infile support */
  int (*local_infile_init)(void **, const char *, void *);
  int (*local_infile_read)(void *, char *, unsigned int);
  void (*local_infile_end)(void *);
  int (*local_infile_error)(void *, char *, unsigned int);
  void *local_infile_userdata;
  void *extension;
};


#ifdef  __cplusplus
}
#endif

#endif /* __LIBCLIENT_OPTIONS_H__ */
